package com.gemme.gemme.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.RelativeLayout;

import com.gemme.gemme.R;
import com.gemme.gemme.wode.AttributeSpecListBean;

import java.util.HashMap;
import java.util.List;

public class GuigeDialog {
    BottomDialog dialog;
    private GuigeSingleView.OnSelectReturn onSelectReturn;
    private List<AttributeSpecListBean> attributeSpecListBeans;
    private String productName;

    public void showDialog(Context mContext,String productName){
        this.productName = productName;
//new int[]{R.id.close}
        dialog = new BottomDialog(mContext, R.layout.guige_dialog,
                null);

        dialog.show();
        initView();
        dialog.setOnBottomItemClickListener(new BottomDialog.OnBottomItemClickListener() {
            @Override
            public void onBottomItemClick(BottomDialog dialog, View view) {
                switch (view.getId()) {
                   /* case R.id.close:
                        dialog.dismiss();
                        break;*/

                }
            }
        });
    }
    GuigeSingleView guigeSingleView;
    private void initView() {
        View view = dialog.getView();
        guigeSingleView = view.findViewById(R.id.guigeSingleView);
        guigeSingleView.findViewById(R.id.guigeSingleView);
    }


    public void setData(List<AttributeSpecListBean> attributeSpecListBeans) {
        this.attributeSpecListBeans = attributeSpecListBeans;
//        detailData();
        guigeSingleView.setData(attributeSpecListBeans,productName);
    }

    HashMap<String, List<AttributeSpecListBean>> hashMap = new HashMap<>();
/*
    private void detailData() {
        try {

            for (int i = 0; i < attributeSpecListBeans.size(); i++) {
                AttributeSpecListBean bean = attributeSpecListBeans.get(i);
                bean.getA
            }
        }catch (Exception e){

        }
    }
*/

    public GuigeDialog setOnSelectReturn(GuigeSingleView.OnSelectReturn onSelectReturn){
        guigeSingleView.setOnSelectReturn(onSelectReturn);
        return this;
    }

    public void dismiss() {
        dialog.dismiss();
    }
}
